package edu.task.snake.controller;


import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;

public class MAdapter extends MouseAdapter {
    private SnakeController snakeController;

    public MAdapter(SnakeController snakeController) {
        this.snakeController = snakeController;
    }

    @Override
    public void mousePressed(MouseEvent e) {
        int modifiers = e.getModifiers();
        if ((modifiers & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK) {
            snakeController.changeDirection("left");
        }
        if ((modifiers & InputEvent.BUTTON3_MASK) == InputEvent.BUTTON3_MASK) {
            snakeController.changeDirection("right");
        }
    }

}
